#include <stdlib.h>
#include "Vector.h"
#include "assert.h"

Vector* vector_new(size_t size)
{
  if (size <= 0)
    size = 1;
  return (Vector*)calloc(sizeof(void*), size + 1);
}

void vector_free(Vector* vector)
{
  free(vector);
}

void vector_set(Vector* vector, long n, void* value)
{
  ((void**)vector)[n] = value;
}

void* vector_get(Vector* vector, long n)
{
  return ((void**)vector)[n];
}

Vector* vector_delete(Vector* vector, long n)
{
  if (vector_get(vector, n) != NULL)
    free(vector_get(vector, n));
  ((void**)vector)[n] = NULL;
  return vector;
}
